﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
	<head>
		<title>Setting Up The Svn Hook Script</title>
	</head>
	<body>
		<h4>Purpose of this Document</h4>
		<p>This document will guide one through setting up the SvnPmtHook app as the recipient of the post-commit args that subversion will pass to it as part of it's normal cycle.</p>
		<h4>Where and What are Hook Scripts</h4>
		<p>Short story long, when anything gets committed to a subversion server the server will look in a hooks folder in the repository file structure to see if there any files there that can be run during different events of the commit process.</p>
		<p>The hooks directory for the subversion repository at <b>svn://svn.twentypints.com/AwishWork</b>, is located at this path: <b>C:\SVN-ROOT\AwishWork\hooks</b>.(remember, this is on the filesystem of the server hosting svn.twentypints.com)</p>
		<p><img src="images/hooksdirectory.png" /></p>
		<h4>The Script File</h4>
		<p>The actual script file doesn't do anything other than kick off the SvnPmtHook exectuable and passes in the repoository path and revision of whatever was just committed.</p>
		<p>The script file will look something like this:(post-commit.bat):</p>
		<p><code>C:\path\to\SvnPmtHook.exe %1 %2</code></p>
		<p>The script file just needs to be named <b>post-commit.bat</b> and must live in the hooks directory to be used by the subversion server.</p>
		<p>Configuring SvnPmtHook</p>
		<p>Find the config file, it's named <b>c:\path\to\SvnPmtHook.exe.config</b>.</p>
		<p>There are currently three settings that need to be configured.</p>
		<p><b>SvnLogService_Url</b></p>
		<p>This is the url for the webservice that will interface with SimplePMT and enter log info into the database. For AwishPMT, this url should be: <b>http://www.twentypints.com/AwishPMT/SvnLogService.asmx</b></p>
		<p><b>SvnlookExe_Path</b></p>
		<p>This is the fully qualified path to svnlook executable, on the twentypints.com server, this: <b>C:\Program Files\CollabNet Subversion Server\svnlook.exe</b></p>
		<p><img src="images/svnlooklocation.png" /></p>
		<p><b>LogFile_Path</b></p>
		<p>This is an optional key, if you need to debug what's going on with SvnPmtHook.exe, set the LogFile_Path to a fully qualified path of a file used for some REALLY simple logging, something like <b>C:\SvnPmtHook.log</b> will work.</p>
		<h4>Final Steps</h4>
		<p>Make sure you can see the web service.  Type the url to the webservice into a browser and make sure it works.</p>
		<p>There's a ton of validation, pretty much every step of the way up until the webservice call.  If you're committing and nothing is showing up in the SvnCommit table, make sure LogFile_Path has a valid path and check the log file.</p>
		<p><b>If the webservice fails</b>, the webservice method returns that information and it's written to the log file.</p>
		<h4>Known Issues</h4>
		<p><b>Usernames</b> are currently different.  We need to sync up the usernames for svn with the usernames in simplepmt.  When we associate svncommits, it's required that we can map the author of a commit to a user in simplepmt, the easiest way to do this is to change all of our subversion usernames to match the simplepmt usernames.</p>
	</body>
</html>